package com.woniuxy.ams.service.impl;

import com.woniuxy.ams.dao.CompanyInspectListDao;
import com.woniuxy.ams.entity.CompanyInspectList;
import com.woniuxy.ams.service.ICompanyInspectListService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公司考核列表service层
 */
@Service
public class CompanyInspectListServiceImpl implements ICompanyInspectListService {

    /**
     * 注入dao
     */
    @Resource
    CompanyInspectListDao companyInspectListDao;

    /**
     * 新增公司考核列表
     * @param companyInspectList
     * @return int
     */
    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public int addCompanyInspectList(CompanyInspectList companyInspectList) {
        return companyInspectListDao.addCompanyInspectList(companyInspectList);
    }

    /**
     * 查询所有公司考核列表
     * @return List<CompanyInspectList>
     */
    @Override
    public List<CompanyInspectList> findAllCompanyInspectList(String appraisalNo, String status) {
        return companyInspectListDao.findAllCompanyInspectList(appraisalNo,status);
    }

    /**
     * 更改公司考核列表
     * @param companyInspectList
     * @return
     */
    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public int updateInspectList(CompanyInspectList companyInspectList) {
        return companyInspectListDao.updateInspect(companyInspectList);
    }

    /**
     * 更改评分状态
     * @param status
     * @param id
     * @return int
     */
    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public int updateScoreStatus(String status,Integer id) {
        return companyInspectListDao.updateScoreStatus(status, id);
    }


}
